<template>
		<view class="cart-number">
			<view class="">
				<image class="Img" src="https://xb-street.oss-cn-shanghai.aliyuncs.com/smallshop/static/index/jian.png" mode="" @tap="addSubtractProduct(-1,num,index)"></image>
			</view>
			<view class="num">
				{{num.number}}
			</view>
			<view class="">
				<image class="Img" src="https://xb-street.oss-cn-shanghai.aliyuncs.com/smallshop/static/index/jia.png" mode="" @tap="addSubtractProduct(+1,num,index)"></image>
			</view>
		</view>
	
</template>

<script>
	export default {
		name:"number",
		props:{
			num:{
				type:Object
				
			}
		},
		data() {
			return {
				
			};
		},
		methods:{
			addSubtractProduct(status, product, index){
				if(this.$parent.addSubtractProduct==undefined){
					this.$parent.$parent.addSubtractProduct(status, product, index);
				}else{
					this.$parent.addSubtractProduct(status, product, index);
				}
				// this.$parent.addSubtractProduct(status, product, index);
				console.log(this.$parent.addSubtractProduct)
			}
			
		}
	}
</script>

<style lang="less" scoped>
		.cart-number{
			display: flex;
			align-items: center;
		}
		.Img{
			width: 48rpx;
			height: 48rpx;
		}
		.num{
			width: 75rpx;
			height: 48rpx;
			background: #FAF7F5;
			border-radius: 12rpx;
			text-align: center;
			line-height: 48rpx;
		}
</style>
